﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Documents;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using 纸片人.win2dEffectControl.DataClass;
using 纸片人.CalculateControls;
// The Templated Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234235

namespace 纸片人.win2dEffectControl
{
    public sealed class HighlightsAndShadowsEffectControl : EffectControl
    {

        CheckBox sourceIsLinearGammaCheckBox;
         TextBoxSlider claritySlider;
        TextBoxSlider highlightsSlider;
        TextBoxSlider maskBlurAmountSlider;
        TextBoxSlider shadowsSlider;

        public override EffectOneSourceData OneEffetData { get; set; }

        public HighlightsAndShadowsEffectControl()
        {
            this.DefaultStyleKey = typeof(HighlightsAndShadowsEffectControl);
            OneEffetData = new HighlightsAndShadowsEffectData();

        }

        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            SetEffectName("高光和阴影", "HighlightsAndShadowsEffect");

            claritySlider = GetTemplateChildFormName<TextBoxSlider>(nameof(claritySlider));
            SetTextBoxSlider(claritySlider, OneEffetData, nameof(HighlightsAndShadowsEffectData.Clarity));

            highlightsSlider = GetTemplateChildFormName<TextBoxSlider>(nameof(highlightsSlider));
            SetTextBoxSlider(highlightsSlider, OneEffetData, nameof(HighlightsAndShadowsEffectData.Highlights));

            maskBlurAmountSlider = GetTemplateChildFormName<TextBoxSlider>(nameof(maskBlurAmountSlider));
            SetTextBoxSlider(maskBlurAmountSlider, OneEffetData, nameof(HighlightsAndShadowsEffectData.MaskBlurAmount));

            shadowsSlider = GetTemplateChildFormName<TextBoxSlider>(nameof(shadowsSlider));
            SetTextBoxSlider(shadowsSlider, OneEffetData, nameof(HighlightsAndShadowsEffectData.Shadows));

            sourceIsLinearGammaCheckBox = GetTemplateChildFormName<CheckBox>(nameof(sourceIsLinearGammaCheckBox));
            SetCheckBox(sourceIsLinearGammaCheckBox, OneEffetData, nameof(HighlightsAndShadowsEffectData.SourceIsLinearGamma));

        }
    }
}
